# encoding: utf-8


"""

@author: tongzhenguo

@time: 2021/5/30 下午3:33

@desc:


"""
import codecs
import glob
import os

from const import STOCK_DAY_GZ_FEATURE_DIR


def merge_one_file(pattern, out_file, recursive=False):
    """匹配文件名，并合并成一个大文件"""
    file_list = glob.glob(pattern, recursive=recursive)
    with codecs.open(out_file, encoding="utf-8", mode="w") as out_f:
        in_f = codecs.open(file_list[0])
        out_f.write(in_f.readlines()[0])
        for in_path in file_list:
            in_f = codecs.open(in_path)
            lines = in_f.readlines()[1:]
            for line in lines:
                out_f.write(line)


def mkdir(path):
    if not os.path.exists(path):
        os.makedirs(path)
        print("success make dir: ", path)


if __name__ == "__main__":
    pass
